from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from .views import (PostCreateView,
    PostDetailView,
    PostListView,
    PostUpdateView, 
    PostDeleteView,
    question_list,
    question_detail,
    answer_list
)

urlpatterns = [
    path('', PostListView.as_view(), name='home'),
    path('post/<int:pk>/', PostDetailView.as_view(), name='detail'),
    path('post/new/', PostCreateView.as_view(), name='create'),
    path('post/update/<int:pk>/', PostUpdateView.as_view(), name='update'),
    path('post/delete/<int:pk>/', PostDeleteView.as_view(), name='delete'),
    path('api/v1/questions', question_list),
    path('api/v1/question/<int:pk>', question_detail),
    path('api/v1/answers', answer_list)

]

urlpatterns = format_suffix_patterns(urlpatterns)
